import base64
import io

import numpy as np
from PIL import Image
from utils.recognize_texts_with_picture_2 import recognize_texts_with_picture_2


# 处理影像信息
def handle_image(src):
    img_base64 = base64.b64decode(src.split(',')[1])
    image = Image.open(io.BytesIO(img_base64))
    im = image.convert('RGB')
    color_arr = np.array(im)
    text_content = recognize_texts_with_picture_2(color_arr)
    return text_content